package com.heima.bos.service;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.heima.bos.dao.DaoInter;
import com.heima.bos.dao.DecidezoneDaoInter;
import com.heima.bos.dao.SubareaDaoInter;
import com.heima.bos.dao.impl.BaseDaoImpl;
import com.heima.bos.domain.Decidezone;
import com.heima.bos.domain.Subarea;
@Service
public class DecidezoneService extends BaseService<Decidezone>{
	@Resource
	private DecidezoneDaoInter decidezoneDao;
	@Resource
	private SubareaDaoInter subareaDao;
	@Override
	public DaoInter<Decidezone> getDao() {
		return decidezoneDao;
	}
	/*
	 * 重写save方法
	 */
	public void save(Decidezone entity, String[] subareaIds) {
		decidezoneDao.save(entity);//持久化对象
		Subarea area = null;
		for (String string : subareaIds) {
			area = subareaDao.findById(string);//持久化对象
			area.setDecidezone(entity);
		}
	}

}
